package com.yan.service.entity.params;


import com.yan.service.criteria.Query;
import com.yan.service.criteria.query.Where;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

/**
 * 通用查询参数
 *
 * @Author: 汪焰
 * @Date: 2020/6/7 23:50
 * @Version: 1.0.0
 **/
@NoArgsConstructor
@AllArgsConstructor
public class BaseParams {

    private Long id;

    /**
     * 开始时间
     */
    @Query(sqlColumn = "create_time", where = Where.Mark.gte)
    private String beginTime;

    /**
     * 截至时间
     */
    @Query(sqlColumn = "create_time", where = Where.Mark.lte)
    private String endTime;

    public BaseParams(Long id) {
        this.id = id;
    }

    public String getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(String beginTime) {
        if (beginTime != null && beginTime.length() > 0) {
            this.beginTime = beginTime + " 00:00:00";
        } else {
            this.beginTime = beginTime;
        }
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        if (endTime != null && endTime.length() > 0) {
            this.endTime = endTime + " 23:59:59";
        }else {
            this.endTime = endTime;
        }
    }
}
